<?php

    include_once("connect.php");

    $tel = $_POST['tel'];
    $password = $_POST['password'];

    // echo(111);
    // echo($password);
    if($tel && $password){

        $sql ="select * from user_info where user_tel = '$tel'";
        $data = mysqli_query($conn, $sql);
        $arr = mysqli_fetch_array($data);
        $res = [];
        if($arr){
            if($arr['user_pwd'] === $password){
                $res['status'] = true;
                $res['msg'] = '登录成功';
                $res['username'] = $arr['user_name'];
            }else{
                $res['status'] = false;
                $res['msg'] = '密码错误';
            }
        }else{
            $res['status'] = false;
            $res['msg'] = '用户名不存在';
        }
    }else{
        echo('数据传输失败');
    }

    echo(json_encode($res));
?>